﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IFRS.Web;
using IFRS.DataAccess.DAL;
using System.Data;
using IFRS.Models;

public partial class IFRS_SEC01_4V : PageBase
{
    #region "---------- Events -----------"
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!(Page.IsPostBack || Page.IsCallback))
        {
            this.ViewMenu();
            this.BindData(Convert.ToInt32(Request.QueryString["id"].ToString()));
        }
        else
            ClientScript.RegisterHiddenField("isPostBack", "1");
    }
    
    protected void btnCANCEL_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/IFRS/SEC01_1S.aspx");
    }

    #endregion
    #region "----- Methods -------"
    private void ViewMenu()
    {
        this.MenuTitleBar = Resources.ifrsMenu.SEC01_1S;
    }

    private void BindData(int ID)
    {
        var vROLEGROUP = new ROLEGROUP();
        DataTable dtRoleGroup = vROLEGROUP.SEARCH_BYID(ID);
        List<RoleGroupU> RoleGroup = new List<RoleGroupU>();
        ConvertHelper.ConvertDataTableToObject(dtRoleGroup, RoleGroup);
        if (dtRoleGroup.Rows.Count > 0)
        {
            txtROLE_GROUP_NAME.Text = RoleGroup[0].RoleGroupName.ToString();//dtRoleGroup.Rows[0]["RoleGroupName"].ToString();

            if (RoleGroup[0].AllBranch.ToString().ToLower() == "true")
            {
                cbJOB.Checked = true;
            }
            if (RoleGroup[0].IsActive.ToString().ToLower() == "true")
            {
                rbSTATUS_1.Checked = true;
            }
            else
            {
                rbSTATUS_2.Checked = true;
            }

        }
    }

    #endregion
 
}